import { defineStore } from "pinia";
import { reactive, ref } from "vue";
import { initIndexDB } from "@/utils/utils";

let indexedDBStore = defineStore('indexedDB', () => {
    let indexedDB = reactive({})
    let unReadCount = ref(0)
    function setDb() {
        return new Promise((resolve, reject) => {
            initIndexDB('tools').then(res => {
                resolve(res)
            })

        })
    }
    return {
        unReadCount,
        indexedDB,
        setDb,
    }
})

export default indexedDBStore